VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsGetFiles"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public Function GetFiles(ByRef File1 As Scripting.File, _
                         ByRef File2 As Scripting.File, _
                         ByRef File3 As Scripting.File, _
                         ByRef File4 As Scripting.File, _
                         ByRef File5 As Scripting.File, _
                         ByRef File6 As Scripting.File, _
                         ByRef j As String) As Boolean


Dim objFS As FileSystemObject
Set objFS = New FileSystemObject

Dim ColFiles As Collection
Set ColFiles = New Collection

Dim strFilePath As String
Dim strCopyTo As String
Dim strMoveFrom
Dim strMoveTo

Dim Folder As Object

Dim Files As Object

Dim FL As Object

Dim i As Integer
Dim nNoOfFiles As Integer


strFilePath = "C:\Data\Extracted\"
strCopyTo = "C:\Data\Sent\"

'GET FILES FROM C:\Data\Test\
Set Folder = objFS.GetFolder(strFilePath)
nNoOfFiles = Folder.Files.Count

If nNoOfFiles > 0 Then
    'SAVE TO COLLECTION
    Set Files = Folder.Files
    For Each FL In Files
       Call ColFiles.Add(FL)
        'COPY FILE / MOVE FILE
        strMoveFrom = strFilePath & FL.Name
        strMoveTo = strCopyTo & FL.Name
        Set objFile = objFS.GetFile(strMoveFrom)
        objFile.Move (strMoveTo)
    Next

    'SAVE FILE TO COLLECTION VARIABLE FOR ATTACHMENT TO EMAIL
    j = ColFiles.Count
    For i = 1 To j
        Select Case i
            Case 1
                Set File1 = ColFiles.Item(i)
            Case 2
                Set File2 = ColFiles.Item(i)
            Case 3
                Set File3 = ColFiles.Item(i)
            Case 4
                Set File4 = ColFiles.Item(i)
            Case 5
                Set File5 = ColFiles.Item(i)
            Case 6
                Set File6 = ColFiles.Item(i)
        End Select
    Next
    
    GetFiles = True
Else
    GetFiles = False
End If
    

End Function



